/*
 ============================================================================
 Name		: DownloadManageView.cpp
 Author	  : JohnLZeng
 Copyright   : Your copyright notice
 Description : CDownloadManageView implementation
 ============================================================================
 */

// INCLUDE FILES
#include <aknviewappui.h>
#include "SHPlatform.h"
#include "DownloadManageView.h"

//copy from ListenVoaAppView.cpp
//#include "ListenVoa.hrh"
//#include <ListenVoa_UID3.rsg>

// ============================ MEMBER FUNCTIONS ===============================
CDownloadManageView::CDownloadManageView()
	{
	// No implementation required
	iContainer = NULL;
	}

CDownloadManageView::~CDownloadManageView()
	{
	DoDeactivate();

	//add your code here ...

	}

CDownloadManageView* CDownloadManageView::NewLC()
	{
	CDownloadManageView* self = new (ELeave) CDownloadManageView();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

CDownloadManageView* CDownloadManageView::NewL()
	{
	CDownloadManageView* self = CDownloadManageView::NewLC();
	CleanupStack::Pop(); // self;
	return self;
	}

void CDownloadManageView::ConstructL()
	{
	BaseConstructL(R_VIEW_DOWNLOAD_MANAGE);

	//add your code here...

	}
/**
 * 
 * */
TUid CDownloadManageView::Id() const
	{
	return TUid::Uid(EListenVoaDownloadManageViewId);
	}

void CDownloadManageView::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case ECommandDownloadManageStart:
			iContainer->Start();
			break;
		case ECommandDownloadManageStop:
			iContainer->Stop();
			break;
		case EAknSoftkeyBack:
			SHChangeView(EListenVoaRSSBriefViewId);
			break;
		default:
			AppUi()->HandleCommandL(aCommand);
		}
	}
void CDownloadManageView::HandleStatusPaneSizeChange()
	{
	if (iContainer != NULL)
		iContainer->SetRect(ClientRect());
	}

/**
 * 
 * */
void CDownloadManageView::DoActivateL(const TVwsViewId& aPrevViewId,
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
	{
	if (iContainer == NULL)
		{
		iContainer = CDownloadManageContainer::NewL(ClientRect());
		iContainer->SetMopParent(this);
		AppUi()->AddToStackL(*this, iContainer);

		//add your init code ...

		}
	}
void CDownloadManageView::DoDeactivate()
	{
	if (iContainer != NULL)
		{
		AppUi()->RemoveFromViewStack(*this, iContainer);
		delete iContainer;
		iContainer = NULL;
		}
	}
// End of File
